package com.scorpio.sdk.constant;

import com.scorpio.common.utils.DateUtils;
import com.scorpio.common.utils.uuid.IdUtils;

public class AliYunConstant {
    //阿里云 keyId
    public static final String ALIYUN_OSS_ACCESSKEYID = "aliyun:access:KeyId";
    //阿里云 KeySecret
    public static final String ALIYUN_OSS_ACCESSKEYSECRET = "aliyun:access:KeySecret";

    //阿里云 短信签名
    public static final String ALIYUN_SMS_SIGNNAME = "aliyun:sms:SignName";
    //阿里云 短信验证码模版
    public static final String ALIYUN_SMS_TEMPLATECODE = "aliyun:sms:TemplateCode";

    //OSS 请求地址
    public static final String ALIYUN_OSS_ENDPOINT = "aliyun:oss:endpoint";
    //OSS 内网请求地址
    public static final String ALIYUN_OSS_ENDPOINT_INTERNAL = "aliyun:oss:endpoint_internal";

    //OSS 公开bucketName
    public static final String ALIYUN_OSS_BUCKETNAME = "aliyun:oss:bucketName";
    //OSS  图片LOGO水印样式
    public static final String ALIYUN_OSS_LOGO_WATERMARK_STYLE = "aliyun:oss:logoWatermarkStype";
    //OSS 图片缩略图样式
    public static final String ALIYUN_OSS_THUMBNAIL_STYLE = "aliyun:oss:thumbnailStyle";
    //封号水印
    public static final String ALIYUN_OSS_FENGHAO_STYLE = "aliyun:oss:fenghaoStyle";
    //头像样式
    public static final String ALIYUN_OSS_AVATAR_STYLE = "aliyun:oss:avatarStyle";

    //url
    public static final String PUBLIC_URL = "https://#{bucketName}.oss-cn-shenzhen.aliyuncs.com/#{path}";

    public static String getPrivatePath() {
        return "private/";
    }

    //通用图片资源路径
    public static String getOssImagePath() {
        return "oss-image";
    }

    //通用音频资源路径
    public static String getOssAudioPath() {
        return "oss-audio";
    }

    //通用视频资源路径
    public static String getOssVideoPath() {
        return "oss-video";
    }


    //通用视频资源路径
    public static String getOssUsage() {
        return "oss-usage";
    }

    //获取上传路径
    public static String getFilePath(String ossTypePath, String extension) {
        return getFilePath(ossTypePath, IdUtils.fastUUID(), extension);
    }

    //获取IM图片上传路径
    public static String getImImagePath(String extension) {
        String fileName = IdUtils.fastUUID() + "." + extension;
        return getOssImagePath() + "/im/" + DateUtils.datePath() + "/" + fileName;
    }

    //获取运营图片路径
    public static String getOperationPath(String extension) {
        String fileName = IdUtils.fastUUID() + "." + extension;
        return getOssImagePath() + "/operation/" + DateUtils.datePath() + "/" + fileName;
    }

    //获取用法文件路径
    public static String getUsagePath(String extension){
        return getFilePath(getOssUsage(), IdUtils.fastUUID(), extension);
    }

    /**
     * 获取上传路径
     *
     * @param ossTypePath
     * @param fileName    文件名
     * @param extension   后缀
     * @return
     */
    public static String getFilePath(String ossTypePath, String fileName, String extension) {
        fileName = fileName + "." + extension;
        return ossTypePath + "/" + DateUtils.datePath() + "/" + fileName;
    }
}
